package com.ht.base.system.biz.client.impl;

import com.ht.base.system.biz.manager.SysDictManager;
import com.ht.base.system.client.SysDictClient;
import com.ht.base.system.common.pojo.bo.SysDictDataBO;
import com.ht.base.system.common.pojo.bo.SysDictTypeBO;
import com.ht.base.system.common.pojo.bo.SysUserBO;
import com.ht.base.system.common.pojo.qto.SysDictDataQTO;
import com.ht.base.system.common.pojo.qto.SysDictTypeQTO;
import org.base.common.appexception.AppException;
import org.base.common.appexception.ResultData;
import org.base.common.page.PageBO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author hdengxian
 * @Date 2023/8/15 17:13
 */
@DubboService
@Component
public class SysDictClientImpl implements SysDictClient {
    @Resource
    private SysDictManager sysDictManager;

    @Override
    public ResultData<Boolean> saveDictType(SysUserBO user, SysDictTypeBO dictTypeBO) throws AppException {
        return new ResultData<>(sysDictManager.saveDictType(user, dictTypeBO));
    }

    @Override
    public ResultData<Boolean> updateDictType(SysUserBO user, SysDictTypeBO dictTypeBO) throws AppException {
        return new ResultData<>(sysDictManager.updateDictType(user, dictTypeBO));
    }

    @Override
    public ResultData<Boolean> deleteDictType(Long sysDictTypeId) throws AppException {
        return new ResultData<>(sysDictManager.deleteDictType(sysDictTypeId));
    }

    @Override
    public ResultData<SysDictTypeBO> findDictTypeById(Long sysDictTypeId) throws AppException {
        return new ResultData<>(sysDictManager.findDictTypeById(sysDictTypeId));
    }

    @Override
    public ResultData<PageBO<SysDictTypeBO>> findDictTypeForPage(SysDictTypeQTO qto) throws AppException {
        return new ResultData<>(sysDictManager.findDictTypeForPage(qto));
    }

    @Override
    public ResultData<Boolean> saveDictData(SysUserBO user, SysDictDataBO dictDataBO) throws AppException {
        return new ResultData<>(sysDictManager.saveDictData(user, dictDataBO));
    }

    @Override
    public ResultData<Boolean> updateDictData(SysUserBO user, SysDictDataBO dictDataBO) throws AppException {
        return new ResultData<>(sysDictManager.updateDictData(user, dictDataBO));
    }

    @Override
    public ResultData<Boolean> deleteDictDataByType(String dictType) throws AppException {
        return new ResultData<>(sysDictManager.deleteDictDataByType(dictType));
    }

    @Override
    public ResultData<Boolean> deleteDictData(String sysDictDataId) throws AppException {
        return new ResultData<>(sysDictManager.deleteDictData(sysDictDataId));
    }

    @Override
    public ResultData<SysDictDataBO> findDictDataById(String sysDictDataId) throws AppException {
        return new ResultData<>(sysDictManager.findDictDataById(sysDictDataId));
    }

    @Override
    public ResultData<List<SysDictDataBO>> findDictDataListByType(String dictType) throws AppException {
        return new ResultData<>(sysDictManager.findDictDataListByType(dictType));
    }

    @Override
    public ResultData<PageBO<SysDictDataBO>> findDictDataForPage(SysDictDataQTO qto) throws AppException {
        return new ResultData<>(sysDictManager.findDictDataForPage(qto));
    }
}
